package com.whfc.ms.api.md.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.common.util.SessionAttr;
import com.whfc.fse.dto.FseCraneDataDetailDTO;
import com.whfc.fse.dto.FseLiftDataDetailDTO;
import com.whfc.fuum.entity.SysUser;
import com.whfc.ms.api.md.service.MdFseBoardService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 数据大屏 - 特种设备
 *
 * @author qzexing
 * @version 1.0
 * @date 2021/12/2 10:50
 */
@RestController
@RequestMapping("/ms/api/md/board/fse")
public class MdFseBoardController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private MdFseBoardService mdFseBoardService;

    @GetMapping(value = "/crane/data/detail")
    public Result craneDataDetail(@SessionAttribute(SessionAttr.MS_USER) SysUser loginUser,
                                  @RequestParam("craneId") Integer craneId) {
        logger.info("大屏-特种设备-塔机运行详情,loginUser:{}, craneId:{}", loginUser.getUsername(), craneId);
        FseCraneDataDetailDTO craneDataDetail = mdFseBoardService.getCraneDataDetail(craneId);
        return ResultUtil.success(craneDataDetail);
    }

    @GetMapping(value = "/lift/data/detail")
    public Result liftDataDetail(@SessionAttribute(SessionAttr.MS_USER) SysUser loginUser,
                                 @RequestParam("liftId") Integer liftId) {
        logger.info("大屏-特种设备-升降机运行详情,loginUser:{}, liftId:{}", loginUser.getUsername(), liftId);
        FseLiftDataDetailDTO liftDataDetail = mdFseBoardService.getLiftDataDetail(liftId);
        return ResultUtil.success(liftDataDetail);
    }


}
